package cn.net.dpi.wlqc.server.action;

import cn.hutool.extra.spring.SpringUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import cn.net.dpi.wlqc.server.handler.Request;
import cn.net.dpi.wlqc.server.handler.Response;

/**
 * 默认的主页Action，当访问主页且没有定义主页Action时，调用此Action
 * @author Looly
 *
 */
public class ECarRegisterAction implements Action{

	private final ObjectMapper objectMapper = SpringUtil.getBean(ObjectMapper.class);

	@Override
	public void doAction(Request request, Response response) {
		ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
		objectNode.put("success",true);
		objectNode.put("message","成功");
        try {
            response.setJsonContent(objectMapper.writeValueAsString(objectNode));
        } catch (Exception e) {
            //ignore
        }
	}

}